using System;
using System.Threading.Tasks;

namespace AvaloniaUI.Modal.Services
{
    /// <summary>
    /// 模态对话框服务接口，定义了显示和关闭模态对话框的方法
    /// </summary>
    public interface IModalService
    {
        /// <summary>
        /// 异步显示模态对话框
        /// </summary>
        /// <typeparam name="TResult">结果类型</typeparam>
        /// <param name="content">对话框内容（通常是ViewModel）</param>
        /// <returns>对话框结果</returns>
        Task<TResult> ShowDialogAsync<TResult>(object content);

        /// <summary>
        /// 异步显示模态对话框，并指定选项
        /// </summary>
        /// <typeparam name="TResult">结果类型</typeparam>
        /// <param name="content">对话框内容（通常是ViewModel）</param>
        /// <param name="options">对话框选项</param>
        /// <returns>对话框结果</returns>
        Task<TResult> ShowDialogAsync<TResult>(object content, ModalDialogOptions options);
        
        /// <summary>
        /// 使用指定ID的ModalHost显示对话框
        /// </summary>
        /// <typeparam name="TResult">结果类型</typeparam>
        /// <param name="content">对话框内容（通常是ViewModel）</param>
        /// <param name="hostId">ModalHost的ID</param>
        /// <returns>对话框结果</returns>
        Task<TResult> ShowDialogAsync<TResult>(object content, string hostId);
        
        /// <summary>
        /// 使用指定ID的ModalHost显示对话框，并指定选项
        /// </summary>
        /// <typeparam name="TResult">结果类型</typeparam>
        /// <param name="content">对话框内容（通常是ViewModel）</param>
        /// <param name="options">对话框选项</param>
        /// <param name="hostId">ModalHost的ID</param>
        /// <returns>对话框结果</returns>
        Task<TResult> ShowDialogAsync<TResult>(object content, ModalDialogOptions options, string hostId);

        /// <summary>
        /// 关闭当前对话框
        /// </summary>
        /// <param name="result">对话框结果</param>
        void CloseDialog(object? result = null);

        /// <summary>
        /// 关闭所有对话框
        /// </summary>
        void CloseAll();
    }
}